import 'package:event_bus/event_bus.dart';

// https://www.jianshu.com/p/e296550e85d2
class EventBusUtil{

  static EventBus? _eventBus;

  static EventBus getInstance() {
    if (_eventBus == null) {
      _eventBus = EventBus();
    }
    return _eventBus!;
  }

}

/*
  @override
  void initState() {
    super.initState();
    EventBusUtils.getInstance().on<TestEvent>().listen((event) {
      print("event bus msg is ="+event.msg +"   state info is  = "+event.state.toString());
    });
  }

  @override
  void dispose() {
    super.dispose();
    EventBusUtils.getInstance().destroy();
  }

  EventBusUtils.getInstance().fire(TestEvent("你是猪么", 200));
 */